#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    button = new QPushButton(this);
    button->setText("切换title");
    button->move(150,150);

    connect(button, &QPushButton::clicked, this, &Widget::handleClicked);

    // connect(button, &QPushButton::clicked, this, &Widget::close);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleClicked()
{
    // 按钮被按下时，窗口标题会发生切换
    this->setWindowTitle("按钮被按下!");
}
